package educar.gui;

import java.awt.BorderLayout;
import java.awt.Component;
import java.awt.Container;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.LayoutManager;

import javax.swing.BorderFactory;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JButton;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
import javax.swing.UIManager;
import javax.swing.WindowConstants;
import javax.swing.border.EmptyBorder;

import educar.controllers.ActividadControllerAlum;
import educar.controllers.DatosController;
import educar.controllers.IController;
import educar.controllers.LoginController;
import educar.controllers.MateriaController;
import educar.controllers.SolucionController;
import educar.models.Session;

public class AlumnoView extends JPanel implements IView {
	private JFrame jfWindow;
	JLabel label1;
	JTextField textField1;
	 JButton button1;
     JButton button2;
     
	public AlumnoView() {
		jfWindow = new JFrame();
		Container container = jfWindow.getContentPane();

		setupMainContainer(container);

		jfWindow.pack();
		jfWindow.setVisible(true);
		jfWindow.setResizable(false);
		jfWindow.setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
	}

	private void setupMainContainer(Container container) {
		container.setLayout((LayoutManager) new BoxLayout(jfWindow
				.getContentPane(), BoxLayout.Y_AXIS));

		((JComponent) container).setBorder(new EmptyBorder(20,70,70, 70));

		JLabel lblWelcome = new JLabel(" Seleccione una opcion: ");
		lblWelcome.setAlignmentX(Component.CENTER_ALIGNMENT);
		lblWelcome.setFont(new Font("Serif", Font.BOLD, 20));
		lblWelcome.setBorder(new EmptyBorder(0, 10, 10, 10));
		container.add(lblWelcome);

			  
		
		//---- button1 ----
				
		JButton binscripcion = new JButton("Inscripcion");
		binscripcion.setFont(new Font("Serif", Font.BOLD, 15));
		binscripcion.setAlignmentX(CENTER_ALIGNMENT);
		container.add(binscripcion);
		
     	LoginListener buttonListener = new LoginListener();
		IController loginController = new MateriaController();
		loginController.setView(this);
		buttonListener.associate(binscripcion, loginController);
	
		JButton bactividad = new JButton("Cargar solucion");
		bactividad.setFont(new Font("Serif", Font.BOLD, 15));
		bactividad.setAlignmentX(CENTER_ALIGNMENT);
			container.add(bactividad);
			
			LoginListener buttonListener2 = new LoginListener();
	    	IController loginController2 = new ActividadControllerAlum();
			loginController2.setView(this);
			buttonListener2.associate(bactividad, loginController2);
		
	}
	
	
	 
	 public void present(String model) {
			JOptionPane.showMessageDialog(null, model);
		}


	
	public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
				try {
					UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
				} catch (Exception ex) {
					// ignore
				}
               javax.swing.JFrame frame = new javax.swing.JFrame("Datos");
                frame.setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
                frame.getContentPane().add(new AlumnoView());
                frame.pack();
                frame.setVisible(false);
             
            }
        });
    }
}